	//
	//  Comm.m
	//  uivc
	//
	//  Created by 包子 on 12-8-10.
	//  Copyright 2012 __MyCompanyName__. All rights reserved.
	//

#import "Comm.h"

static Comm* sharedComm = nil;

@implementation Comm

@synthesize user;
@synthesize product;
@synthesize debug;


+(id)instance{
	if (sharedComm==nil) {
		sharedComm = [[super alloc]init];
		User * user = [User alloc];
		Product * product = [Product alloc];
		sharedComm.user = user;
		sharedComm.product = product;
		sharedComm.debug = TRUE;
		
		[user release];
		[product release];
	}
	return sharedComm;
}

+(NSString *)currentTime{
	NSString *ss = [self formateTime:[NSDate date]];
	return ss;
}

+(NSString *)formateTime:(NSDate*) date{
	NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
	[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
	NSString *ss = [dateFormatter stringFromDate:date];
	return ss;
}

+(void)print:(NSString*) msg{
	if (debug) {
		NSLog(msg);
	}
}


@end
